import { observable, action, toJS } from 'mobx';
import * as ManuallydispatchAPI from '../apis/manuallyDispatch'
import {Modal} from 'antd'
import {WeaLocaleProvider} from "ecCom";
const getLabel = WeaLocaleProvider.getLabel;

export default class GrabSingle{

	//抢单
	@action grabSingle(params={}){
		ManuallydispatchAPI.grabSingle(params).then(data =>{
			let result = data.result;
			if("2"==result){
				Modal.warning({
					title: getLabel(15172, "系统提示"),
					content: getLabel(503905, "您当前暂未达到饱和度，不可以抢单！")
				});
			}else if("1"==result){
				Modal.warning({
					title: getLabel(15172, "系统提示"),
					content: getLabel(381925, "抢单")+getLabel(15242, "成功")
				});
			}else{
				Modal.warning({
					title: getLabel(15172, "系统提示"),
					content: getLabel(381925, "抢单")+getLabel(498, "失败")
				});
			}
		});
	}
}
